Integrand size = 32, antiderivative size = 66 \[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-1-n} \, dx=\frac {i \operatorname {Hypergeometric2F1}\left (2,n,1+n,\frac {1}{2} (1-i \tan (e+f x))\right ) (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n}}{4 a f n} \]
[Out]
Time = 0.22 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3586, 3603, 3568, 70} \[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-1-n} \, dx=\frac {i (a+i a \tan (e+f x))^{-n} (d \sec (e+f x))^{2 n} \operatorname {Hypergeometric2F1}\left (2,n,n+1,\frac {1}{2} (1-i \tan (e+f x))\right )}{4 a f n} \]
[In]
[Out]
Rule 70
Rule 3568
Rule 3586
Rule 3603
Rubi steps \begin{align*} \text {integral}& = \left ((d \sec (e+f x))^{2 n} (a-i a \tan (e+f x))^{-n} (a+i a \tan (e+f x))^{-n}\right ) \int \frac {(a-i a \tan (e+f x))^n}{a+i a \tan (e+f x)} \, dx \\ & = \frac {\left ((d \sec (e+f x))^{2 n} (a-i a \tan (e+f x))^{-n} (a+i a \tan (e+f x))^{-n}\right ) \int \cos ^2(e+f x) (a-i a \tan (e+f x))^{1+n} \, dx}{a^2} \\ & = \frac {\left (i a (d \sec (e+f x))^{2 n} (a-i a \tan (e+f x))^{-n} (a+i a \tan (e+f x))^{-n}\right ) \text {Subst}\left (\int \frac {(a+x)^{-1+n}}{(a-x)^2} \, dx,x,-i a \tan (e+f x)\right )}{f} \\ & = \frac {i \operatorname {Hypergeometric2F1}\left (2,n,1+n,\frac {1}{2} (1-i \tan (e+f x))\right ) (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n}}{4 a f n} \\ \end{align*}
Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(165\) vs. \(2(66)=132\).
Time = 12.19 (sec) , antiderivative size = 165, normalized size of antiderivative = 2.50 \[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-1-n} \, dx=\frac {i 2^{-2+n} e^{i e} \left (e^{i f x}\right )^{-n} \left (\frac {e^{i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^n \left (1+e^{2 i (e+f x)}\right )^2 \operatorname {Hypergeometric2F1}\left (2,2-n,3-n,1+e^{2 i (e+f x)}\right ) \sec ^{1-n}(e+f x) (d \sec (e+f x))^{2 n} (\cos (f x)+i \sin (f x))^{1+n} (a+i a \tan (e+f x))^{-1-n}}{f (-2+n)} \]
[In]
[Out]
\[\int \left (d \sec \left (f x +e \right )\right )^{2 n} \left (a +i a \tan \left (f x +e \right )\right )^{-1-n}d x\]
[In]
[Out]
\[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-1-n} \, dx=\int { \left (d \sec \left (f x + e\right )\right )^{2 \, n} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{-n - 1} \,d x } \]
[In]
[Out]
\[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-1-n} \, dx=\int \left (d \sec {\left (e + f x \right )}\right )^{2 n} \left (i a \left (\tan {\left (e + f x \right )} - i\right )\right )^{- n - 1}\, dx \]
[In]
[Out]
Exception generated. \[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-1-n} \, dx=\text {Exception raised: RuntimeError} \]
[In]
[Out]
\[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-1-n} \, dx=\int { \left (d \sec \left (f x + e\right )\right )^{2 \, n} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{-n - 1} \,d x } \]
[In]
[Out]
Timed out. \[ \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-1-n} \, dx=\int \frac {{\left (\frac {d}{\cos \left (e+f\,x\right )}\right )}^{2\,n}}{{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^{n+1}} \,d x \]
[In]
[Out]